This is an R Markdown document. I can type whatever I want.

this is bold this is italic ### this will make the font smaller ##this will make it slightly bigger

Cheatsheet to these things here: https://www.rstudio.com/wp-content/uploads/2015/02/rmarkdown-cheatsheet.pdf

  1. save this file
  2. to view in however it would be. use “knit” button

HTML : online only or knit it to a PDF or word doc to send to your PI (word can be funky) PDF does require additional download to work

You can click “insert” button for R or python or other code chunks OR ctrl+alt+i (PC) cmd+option+i (MAC) - use codechunk just like you would other script

SETTINGS: tell it to just output i nthe consol not inlline

TO not print when we knit :: warning=faslse message=false, echo=FALSE (don’t show code)

or FUNCTION to do this “suppress” for a single library suppressPackageStartupMessages(library(tidyverse))

library(tidyverse)
glimpse(storms)
## Observations: 10,010
## Variables: 13
## $ name        <chr> "Amy", "Amy", "Amy", "Amy", "Amy", "Amy", "Amy", "...
## $ year        <dbl> 1975, 1975, 1975, 1975, 1975, 1975, 1975, 1975, 19...
## $ month       <dbl> 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7,...
## $ day         <int> 27, 27, 27, 27, 28, 28, 28, 28, 29, 29, 29, 29, 30...
## $ hour        <dbl> 0, 6, 12, 18, 0, 6, 12, 18, 0, 6, 12, 18, 0, 6, 12...
## $ lat         <dbl> 27.5, 28.5, 29.5, 30.5, 31.5, 32.4, 33.3, 34.0, 34...
## $ long        <dbl> -79.0, -79.0, -79.0, -79.0, -78.8, -78.7, -78.0, -...
## $ status      <chr> "tropical depression", "tropical depression", "tro...
## $ category    <ord> -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, ...
## $ wind        <int> 25, 25, 25, 25, 25, 25, 25, 30, 35, 40, 45, 50, 50...
## $ pressure    <int> 1013, 1013, 1013, 1013, 1012, 1012, 1011, 1006, 10...
## $ ts_diameter <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA...
## $ hu_diameter <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA...
library(viridis)

#create plot with pressure and something on xy axis 

ggplot(data=storms)+
  geom_jitter(aes(x= as.factor(month), y = pressure, fill=wind), pch= 21, alpha= .05)+
  scale_fill_viridis_c()+
  theme_bw()+
  labs(title= "Hurricane Pressure v Month", subtitle = "with Max Wind Speed", x = "Month")

writing out equations in Rmarkdown:

If you want to write an equation, you put a $ on either side of it.

\(\sum_{i=y}^n X_i\)

library(knitr)

kable(head(storms),caption="table using kable")
table using kable
name year month day hour lat long status category wind pressure ts_diameter hu_diameter
Amy 1975 6 27 0 27.5 -79.0 tropical depression -1 25 1013 NA NA
Amy 1975 6 27 6 28.5 -79.0 tropical depression -1 25 1013 NA NA
Amy 1975 6 27 12 29.5 -79.0 tropical depression -1 25 1013 NA NA
Amy 1975 6 27 18 30.5 -79.0 tropical depression -1 25 1013 NA NA
Amy 1975 6 28 0 31.5 -78.8 tropical depression -1 25 1012 NA NA
Amy 1975 6 28 6 32.4 -78.7 tropical depression -1 25 1012 NA NA
htmlTable::htmlTable(head(storms))
name year month day hour lat long status category wind pressure ts_diameter hu_diameter
1 Amy 1975 6 27 0 27.5 -79 tropical depression -1 25 1013
2 Amy 1975 6 27 6 28.5 -79 tropical depression -1 25 1013
3 Amy 1975 6 27 12 29.5 -79 tropical depression -1 25 1013
4 Amy 1975 6 27 18 30.5 -79 tropical depression -1 25 1013
5 Amy 1975 6 28 0 31.5 -78.8 tropical depression -1 25 1012
6 Amy 1975 6 28 6 32.4 -78.7 tropical depression -1 25 1012
#make an interactive table 
DT::datatable(storms)
## Warning in instance$preRenderHook(instance): It seems your data is too
## big for client-side DataTables. You may consider server-side processing:
## https://rstudio.github.io/DT/server.html
library(plotly)
## 
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
## 
##     last_plot
## The following object is masked from 'package:stats':
## 
##     filter
## The following object is masked from 'package:graphics':
## 
##     layout
ggplotly(
  ggplot(data=storms)+
  geom_jitter(aes(x= as.factor(month), y = pressure, fill=wind), pch= 21, alpha= .05)+
  scale_fill_viridis_c()+
  theme_bw()+
  labs(title= "Hurricane Pressure v Month", subtitle = "with Max Wind Speed", x = "Month"))
## Warning in L$marker$color[idx] <- aes2plotly(data, params, "fill")[idx]:
## number of items to replace is not a multiple of replacement length

R Markdown

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.

When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

summary(cars)
##      speed           dist       
##  Min.   : 4.0   Min.   :  2.00  
##  1st Qu.:12.0   1st Qu.: 26.00  
##  Median :15.0   Median : 36.00  
##  Mean   :15.4   Mean   : 42.98  
##  3rd Qu.:19.0   3rd Qu.: 56.00  
##  Max.   :25.0   Max.   :120.00

Including Plots

You can also embed plots, for example:

Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.